<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script type="text/javascript" src="static/js/jquery.min.js"></script>
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap.min.css" />
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap-treeview.min.css"
          th:href="@{static/js/bootstrap/css/bootstrap-treeview.min.css}"
    >
    <script src="static/js/bootstrap/js/bootstrap-treeview.min.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap.addtabs.css">
    <script src="static/js/bootstrap/js/bootstrap.addtabs.min.js"></script>
    <link rel="stylesheet" href="static//js/bootstrap/css/bootstrap-table.min.css">
    <script src="static/js/bootstrap/js/bootstrap-table.min.js"></script>
    <script src="static/js/bootstrap/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="static/js/bootstrap/js/bootbox.js"></script>
    <link rel="stylesheet"
          href="static/js/bootstrap/css/bootstrap-datetimepicker.min.css" />
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript"
            src="static/js/bootstrap/js/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="static/js/bootstrap-fileinput/js/fileinput.js"></script>
    <script src="static/js/bootstrap-fileinput/js/locales/zh.js"></script>
    <link rel="stylesheet" href="static/js/bootstrap-fileinput/css/fileinput.css">

</head>
<body>
<!-- MOdel取主表Id -->
<input id="span1" th:type="hidden" th:value="${nbCh.queryPriceId}">
<input id="span2" th:type="hidden" th:value="${nbCh.address}">
<input id="span3" th:type="hidden" th:value="${nbCh.queryPriceRequirementType}">
<!-- 材料单回显列表 -->
<form id="myform" method="post">

    <div class="modal-header" style="background-color: #afd9ee">
        <h4 class="modal-title" id="myModalLabel">查看材料单</h4>
    </div>

    <div class="form-group">
        <label for="materialsType">类目</label>
        <input type="text" class="form-control" id="materialsType" placeholder="类目" name="materialsType">
    </div>

    <div class="form-group">
        <label for="materialsName">物料名称</label>
        <input type="text" class="form-control" id="materialsName" placeholder="物料名称" name="materialsName">
    </div>

    <div class="form-group">
        <label for="materialsId">物料编码</label>
        <input type="text" class="form-control" id="materialsId" placeholder="物料名称" name="materialsId">
    </div>

    <div class="form-group">
        <label for="materialsCount">数量</label>
        <input type="text" class="form-control" id="materialsCount" placeholder="数量" name="materialsCount">
    </div>

    <div class="form-group">
        <label for="brand">品牌</label>
        <input type="text" class="form-control" id="brand" placeholder="数量" name="brand">
    </div>

    <div class="form-group">
        <label for="price">单价(元)</label>
        <input type="text" class="form-control" id="price" placeholder="数量" name="price">
    </div>
</form>

<!-- 价格表回显列表 -->
<form id="myform1" method="post">

    <div class="modal-header" style="background-color: #afd9ee">
        <h4 class="modal-title" id="myModalLabel1">服务项报价</h4>
    </div>

    <div class="form-group">
        <label for="materialsType">运费</label>
        <input type="text" class="form-control" id="freight" placeholder="运费" name="freight">
    </div>

    <div class="form-group">
        <label for="assemblingCharge">组装费</label>
        <input type="text" class="form-control" id="assemblingCharge" placeholder="组装费" name="assemblingCharge">
    </div>


</form>

<button onclick="submitOrder()">提交订单</button>
</body>
<script>
    var nbCh = $("#span1").val()

    var nbCh2 = $("#span2").val()

    var nbCh3 = $("#span3").val()

    var input= $("#input3").val()
    $(function(){
        selectHuiChr();
        selectUpHuiChr();
    })

    //提交订单
     function submitOrder(){
        $.ajax({
            url:'submitOrder',
            type:'post',
            data:{totalPrice:aaa,nbCh2:nbCh2,nbCh:nbCh},
            success:function(){
            }
        })

     }




     var aaa=null;
    function selectHuiChr(){
        $('#myModal').modal("show");
        $.ajax({
            url: 'selectHuiChr',
            data:{nbCh:nbCh,nbCh2:nbCh2,nbCh3:nbCh3},
            success: function (data) {
                aaa = data.totalPrices
                /*需要回显的话用下面的方法 需要传Id的话加Id*/
                $("input[name='materialsType']").val(data.materialsType);
                $("input[name='materialsName']").val(data.materialsName);
                $("input[name='materialsId']").val(data.materialsId);
                $("input[name='materialsCount']").val(data.materialsCount);
                $("input[name='brand']").val(data.brand);
                $("input[name='price']").val(data.price);
                $("input[name='freight']").val(data.freight);
                $("input[name='assemblingCharge']").val(data.assemblingCharge);
            }
        })
    }
</script>
</html>